'''
Created on Mar 31, 2012

@author: e911miri
'''

import sys
import os
import cherrypy
from cherrypy.lib import cpstats

sys.path.append(os.path.join(os.path.dirname('__file__'), 'modules'))
sys.path.append(os.path.join(os.path.dirname('__file__'), 'Controllers'))
sys.path.append(os.path.join(os.path.dirname('__file__'), 'Tools'))
sys.path.append(os.path.join(os.path.dirname('__file__'), 'db'))
sys.path.append(os.path.join(os.path.dirname('__file__'), 'models'))


from config import _cp_config , _admin_config

from memcachedplugin import MemcachedPlugin
from memcachedtool import MemcachedTool


MemcachedPlugin(cherrypy.engine).subscribe()
cherrypy.tools.memcache = MemcachedTool()


from helloController import Root, defaulterror
from adminController import Admin
root = Root()


root.cpstats = cpstats.StatsPage()
admin= Admin()



cherrypy.config.update({'error_page.default': defaulterror, 'tools.sessions.on': True, })

cherrypy.tree.mount(root, "/", config=_cp_config)
cherrypy.tree.mount(admin, "/admin", config=_admin_config)
cherrypy.engine.start()
cherrypy.engine.block()
